/**
 * @file Service_Debug.cpp
 * @author Glorill 1615688664@qq.com
 * @brief 调试创建的临时线程
 * @version 0.1
 * @date 2022-02-04
 * 
 * @copyright Copyright (c) 2022
 * 
 */

/* Includes ------------------------------------------------------------------*/

#include "Service_Debug.h"
#include "Service_Communication.h"

#include "Serial_Plot.h"

/* Private macros ------------------------------------------------------------*/

/* Private types -------------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/

TaskHandle_t Debug_Handle;

/* Private function declarations ---------------------------------------------*/

void Task_Debug(void *arg);

/* Function prototypes -------------------------------------------------------*/


// void Variable_Send_Packet(void)
// {
//     serial_plot.Add_Var(DR16.Get_LX_Norm());
//     serial_plot.Add_Var(DR16.Get_LY_Norm());
//     serial_plot.Add_Var(DR16.Get_RX_Norm());
//     serial_plot.Add_Var(DR16.Get_RY_Norm());
//     serial_plot.Add_Var(DR16.GetSW_L());
//     serial_plot.Add_Var(DR16.Get_Yaw_Norm());
//     serial_plot.Add_Var(DR16.GetStatus());
// }
// Serial_Plot DR16Data(NULL, 0, NULL, Variable_Send_Packet);

/**
 * @brief 临时debug线程
 * 
 * @param arg 
 */
void Task_Debug(void *arg)
{
    for (;;)
    {
        static uint16_t prescale=0;
        if(prescale++>=10)
        {
            prescale = 0;
            // DR16Data.Send_Packet();
        }
        
        vTaskDelay(1);  // Pass to next ready task
    }
}

/**
 * @brief 新建线程
 * 
 */
void Service_Debug_Init(void)
{
    xTaskCreate(Task_Debug, "Debug_Service", Normal_Stack_Size, NULL, PriorityBelowNormal, &Debug_Handle);
}

/************************ COPYRIGHT(C) USTC-ROBOWALKER **************************/
